package com.crm.entity;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name="users")
public class User {
@Id
private String userId;//用户ID
private String userName;//用户登录名
private String userPassWord;//用户密码
@Column(insertable = false,columnDefinition = "int default 0")
private Integer userIsLockout;//用户是否锁定:默认不锁定
private String userUpdateTime;//用户信息最后一次被修改时间:数据库自己维护记录的修改时间
private String userCreateTime;//用户账号创建时间
private String userLastLoginTime;//用户上一次登录时间
private String userLastLoginIp;//用户上一次登录实际IP地址
@Column(insertable = false,columnDefinition = "int default 0")
private Integer userPassWrongCout;//用户输入密码错误次数
private String userLockoutTime;//用户输入密码错误次数达到上限锁定时间
private String userEmail;//用户密保邮箱
private String userTelephone;//用户密保电话
private String checkState;//签到状态
@ManyToOne(fetch=FetchType.EAGER)
@JoinColumn(name="bmId")
private Department bm;//外键(部门id)
@ManyToMany(fetch=FetchType.EAGER)
@JoinTable(
		name="user_role",
		joinColumns= {@JoinColumn(name="userId")},//维护方主键
		inverseJoinColumns= {@JoinColumn(name="roleId")}//被维护方主键
		)
private List<Role> rlist;
public User(String userId, String userName, String userPassWord, Integer userIsLockout, String userUpdateTime,
		String userCreateTime, String userLastLoginTime, String userLastLoginIp, Integer userPassWrongCout,
		String userLockoutTime, String userEmail, String userTelephone, String checkState, Department bm,
		List<Role> rlist) {
	super();
	this.userId = userId;
	this.userName = userName;
	this.userPassWord = userPassWord;
	this.userIsLockout = userIsLockout;
	this.userUpdateTime = userUpdateTime;
	this.userCreateTime = userCreateTime;
	this.userLastLoginTime = userLastLoginTime;
	this.userLastLoginIp = userLastLoginIp;
	this.userPassWrongCout = userPassWrongCout;
	this.userLockoutTime = userLockoutTime;
	this.userEmail = userEmail;
	this.userTelephone = userTelephone;
	this.checkState = checkState;
	this.bm = bm;
	this.rlist = rlist;
}
public User() {
	super();
	// TODO Auto-generated constructor stub
}
public String getUserId() {
	return userId;
}
public void setUserId(String userId) {
	this.userId = userId;
}
public String getUserName() {
	return userName;
}
public void setUserName(String userName) {
	this.userName = userName;
}
public String getUserPassWord() {
	return userPassWord;
}
public void setUserPassWord(String userPassWord) {
	this.userPassWord = userPassWord;
}
public Integer getUserIsLockout() {
	return userIsLockout;
}
public void setUserIsLockout(Integer userIsLockout) {
	this.userIsLockout = userIsLockout;
}
public String getUserUpdateTime() {
	return userUpdateTime;
}
public void setUserUpdateTime(String userUpdateTime) {
	this.userUpdateTime = userUpdateTime;
}
public String getUserCreateTime() {
	return userCreateTime;
}
public void setUserCreateTime(String userCreateTime) {
	this.userCreateTime = userCreateTime;
}
public String getUserLastLoginTime() {
	return userLastLoginTime;
}
public void setUserLastLoginTime(String userLastLoginTime) {
	this.userLastLoginTime = userLastLoginTime;
}
public String getUserLastLoginIp() {
	return userLastLoginIp;
}
public void setUserLastLoginIp(String userLastLoginIp) {
	this.userLastLoginIp = userLastLoginIp;
}
public Integer getUserPassWrongCout() {
	return userPassWrongCout;
}
public void setUserPassWrongCout(Integer userPassWrongCout) {
	this.userPassWrongCout = userPassWrongCout;
}
public String getUserLockoutTime() {
	return userLockoutTime;
}
public void setUserLockoutTime(String userLockoutTime) {
	this.userLockoutTime = userLockoutTime;
}
public String getUserEmail() {
	return userEmail;
}
public void setUserEmail(String userEmail) {
	this.userEmail = userEmail;
}
public String getUserTelephone() {
	return userTelephone;
}
public void setUserTelephone(String userTelephone) {
	this.userTelephone = userTelephone;
}
public String getCheckState() {
	return checkState;
}
public void setCheckState(String checkState) {
	this.checkState = checkState;
}
public Department getBm() {
	return bm;
}
public void setBm(Department bm) {
	this.bm = bm;
}
public List<Role> getRlist() {
	return rlist;
}
public void setRlist(List<Role> rlist) {
	this.rlist = rlist;
}
@Override
public String toString() {
	return "User [userId=" + userId + ", userName=" + userName + ", userPassWord=" + userPassWord + ", userIsLockout="
			+ userIsLockout + ", userUpdateTime=" + userUpdateTime + ", userCreateTime=" + userCreateTime
			+ ", userLastLoginTime=" + userLastLoginTime + ", userLastLoginIp=" + userLastLoginIp
			+ ", userPassWrongCout=" + userPassWrongCout + ", userLockoutTime=" + userLockoutTime + ", userEmail="
			+ userEmail + ", userTelephone=" + userTelephone + ", checkState=" + checkState + ", bm=" + bm + ", rlist="
			+ rlist + "]";
}


}
